home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / lame_src / new_clock.c < prev    next >
C/C++ Source or Header  |  2000-01-01  |  431b  |  25 lines

  1. /*
  2.  * Replacement for the buggy clock() function in GCC WarpUP.
  3.  * Written by Jarmo Laakkonen jami.laakkonen@kolumbus.fi
  4.  *
  5.  */
  6.  
  7. #include <time.h>
  8. #include <powerpc/powerpc_protos.h>
  9.  
  10. clock_t clock(void)
  11. {
  12.     struct timeval tv;
  13.     static ULONG start_time = 0;
  14.     ULONG current_time;
  15.  
  16.     GetSysTimePPC(&tv);
  17.  
  18.     if (!start_time)
  19.         start_time = tv.tv_secs;
  20.  
  21.     current_time = tv.tv_secs;
  22.  
  23.     return (current_time - start_time) * CLOCKS_PER_SEC;
  24. }
  25.